//
//  MerchantInforCell.m
//  ImGuider
//
//  Created by 王鹏宇 on 2018/6/5.
//  Copyright © 2018年 imguider. All rights reserved.
//

#import "MerchantInforCell.h"

@implementation MerchantInforCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
     self.selectionStyle = UITableViewCellSelectionStyleNone;
    self.titleLabel.font = FontBold(14);
    self.titleLabel.textColor = kSubitleColor;
}

- (IBAction)actionBtnClicked:(UIButton *)sender {
    
    if (_delegate && [_delegate respondsToSelector:@selector(goAction:)]) {
        [_delegate goAction:self.type];
    }
}


- (void)setModel:(MerchantModel *)model {
    
    _model = model;
    
    switch (self.type) {
        case MerchantTypeTel:
        {
            self.titleLabel.text = [NSString stringWithFormat:@"%@:",MYLocalizedString(@"SITELIST_PHONE", nil)];
            [self.actionBtn setTitle:model.tel forState:UIControlStateNormal];
            self.descLabel.hidden = YES;
            self.actionBtn.hidden = NO;
        }
            break;
        case MerchantTypeWeb:
        {
            self.titleLabel.text = [NSString stringWithFormat:@"%@:",MYLocalizedString(@"SITELIST_WEBSITE", nil)];
            [self.actionBtn setTitle:model.website forState:UIControlStateNormal];
            self.descLabel.hidden = YES;
            self.actionBtn.hidden = NO;
        }
            break;
        case MerchantTypeOpenTime:
        {
            self.titleLabel.text = [NSString stringWithFormat:@"%@:",MYLocalizedString(@"HOMEPAGE_OPENTIME", nil)];
            [self.actionBtn setTitle:@"" forState:UIControlStateNormal];
            self.actionBtn.hidden = YES;
            self.descLabel.hidden = NO;
            self.descLabel.text = model.opentime;
        }
           break;
        case MerchantTypeAdress:
        {
            self.titleLabel.text = [NSString stringWithFormat:@"%@:",MYLocalizedString(@"SITELIST_ADDRESS", nil)];
            [self.actionBtn setTitle:model.address forState:UIControlStateNormal];
            self.descLabel.hidden = YES;
            self.actionBtn.hidden = NO;
        }
            break;
        default:
            break;
    }
}

- (void)setScenic:(Scenic *)scenic {
    _scenic = scenic;
    
    switch (self.type) {
        case MerchantTypeTel:
        {
            self.titleLabel.text = MYLocalizedString(@"SITELIST_PHONE", nil);
            [self.actionBtn setTitle:scenic.telephone forState:UIControlStateNormal];
            self.descLabel.hidden = YES;
            self.actionBtn.hidden = NO;
        }
            break;
        case MerchantTypeWeb:
        {
            self.titleLabel.text = MYLocalizedString(@"SITELIST_WEBSITE", nil);
            [self.actionBtn setTitle:scenic.website forState:UIControlStateNormal];
            self.descLabel.hidden = YES;
            self.actionBtn.hidden = NO;
        }
            break;
//        case MerchantTypeTime:
//        {
//            self.titleLabel.text = @"用时参考";
//            [self.actionBtn setTitle:@"" forState:UIControlStateNormal];
//            self.actionBtn.hidden = YES;
//            self.descLabel.hidden = NO;
//            self.descLabel.text = scenic.tips;
//        }
//            break;
        default:
            break;
    }
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
